package com.heima.apis.interceptor;

import com.heima.utils.thread.AppThreadLocalUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: xrl
 * @Date: 2022/10/9  10:20
 * @Version 1.0
 */
@Slf4j
public class MyFeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        log.info("===request: {}", template.url());
        Integer id = AppThreadLocalUtil.getUser().getId();
        template.header("userId", id.toString());
    }
}
